<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script>
			new Promise(function(resolve,reject){
				setTimeout(function(){
					console.log("aaa");
					resolve();
				},3000);
			}).then((resolve)=>{
				console.log("成功了")
			}).catch((reject)=>{
				console.log("发生异常")
			})
			
			//写法2
			var promise = new Promise(function(resolve,reject){
				setTimeout(function(){
					if(1<2){
						reject();
					}
					resolve();
				},3000);
			});
			
			promise.then((resolve)=>{
				console.log("成功了")
			}).catch((reject)=>{
				console.log("发生异常")
			}).finally(()=>{
				console.log("我是finally");
			})
		</script>
	</body>
</html>